/**
 * @file commands.c
 * @author MaxwellWang
 * @brief 
 * @version v1.0.0
 * @date 2025/11/24
 * @copyright Copyright (c) 2025
 * this file is part of the mw-iap firmware
*/

#include "commands.h"

#include <string.h>
#include <stdarg.h>
#include <stdio.h>

static void(* volatile send_func)(unsigned char *data, unsigned int len) = 0;
static bool is_init = false;

void commands_init(void){
    is_init = true;
}

bool commands_is_init(void){
    return is_init;
}

/**
 * Send a packet using the set send function.
 *
 * @param data
 * The packet data.
 *
 * @param len
 * The data length.
 */
void commands_send_packet(unsigned char *data, unsigned int len) {
	if (send_func) {
		send_func(data, len);
	}
}
